package com.eflow.engine.handler;

import com.eflow.model.domain.EflowUser;
import com.eflow.model.flowable.handler.IProxyUserHandler;
import com.eflow.model.flowable.model.UserElement;
import com.eflow.model.service.IEflowUserService;
import org.flowable.engine.repository.ProcessDefinition;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class ProxyUserHandler implements IProxyUserHandler {

    @Autowired
    private IEflowUserService eflowUserService;

    @Override
    public List<EflowUser> proxyList(List<EflowUser> user, UserElement userElement, String loginUser, ProcessDefinition processDefinition, String processInstanceId, String activityId, Map<String, Object> var) {
        if(!user.isEmpty()){
          return  eflowUserService.selectProxyUserByUser( user);
        }
        return user;
    }
}
